<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="redis" uri="http://www.shopjsp.com/redisTag/functions" %>
<c:set var="basePath" value="${redis:getSysConfig('base_path_back')}"/>
	<script type="text/javascript">
		function oplog(){
            var selectedRow = $("#tt").bootstrapTable('getSelections');
            if(selectedRow.length==1){
                $("#btn_ordersOpLog").attr("data-target","#detailOrdersOpLogModal");
            	var ordersNo=selectedRow[0].ordersNo;
				$.ajax({
				   type: "POST",
				   dataType: "JSON",
				   url: "${basePath}/back/orders/getOrdersOPLogObject.sjson",
				   data: {ordersNo:ordersNo},
				   success: function(result){
					   var data = JSON.parse(result.data);
					   var logList= data.ordersOPLogList;
					   var showLog = "<tr class='titlebg'><td align='center' colspan='3'>订单号:&nbsp;&nbsp;&nbsp;&nbsp;"+data.ordersNo+"<\/td><\/tr>";
					   showLog+="<tr><td align='center' width='300px;'>操作类型<\/td><td align='center' width='300px;'>操作人<\/td><td align='center' width='300px;'>操作时间<\/td><\/tr>";
					   for(var i=0;i<logList.length;i++){
						   var state="";
						   var data=new Date(logList[i].operatorTime).Format("yyyy-MM-dd hh:mm:ss");//格式化时间
						   if(logList[i].ordersOperateState==0||logList[i].ordersOperateState==1){
							   state="生成订单";
						   }else if(logList[i].ordersOperateState==2){
							   state="已付款";
						   }else if(logList[i].ordersOperateState==3){
							   state="已配货";
						   }else if(logList[i].ordersOperateState==4){
							   state="已发货";
						   }else if(logList[i].ordersOperateState==5){
							   state="完成";
						   }else if(logList[i].ordersOperateState==6){
							   state="取消订单";
						   }else if(logList[i].ordersOperateState==7){
							   state="异常订单";
						   }else if(logList[i].ordersOperateState==8){
							   state="修改订单";
						   }
						   showLog+="<tr><td align='center'>"+state+"<\/td><td align='center'>"+logList[i].operatorName+"<\/td><td align='center'>"+data+"<\/td><\/tr>";
						}
					   $("#showLog").html(showLog);
				   }
				});
            }else{
                $("#btn_ordersOpLog").attr("data-target","");
                showMsg("请选择一行记录！");
            }
        }
    </script>
	  <div class="modal fade" id="detailOrdersOpLogModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog" style="width:70%">
			  <div class="modal-content">
				  <div class="modal-header">
					  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					  <h5 class="modal-title" id="myModalLabel">订单日志信息</h5>
				  </div>
				  <div class="modal-body">
		  				<table id="showLog" align="center" class="addOrEditTable table table-bordered"></table>
				  </div>
				  <div class="modal-footer">
					  <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				  </div>
			  </div>
		  </div>
	  </div>
